usbcpower2 2.2.0
Loading...
Searching...
No Matches
USB-C Power 2 Click Driver

API for configuring and manipulating USB-C Power 2 Click driver. More...

Topics

 USB-C Power 2 Registers List
 List of registers of USB-C Power 2 Click driver.
 USB-C Power 2 Registers Settings
 Settings for registers of USB-C Power 2 Click driver.
 USB-C Power 2 MikroBUS Map
 MikroBUS pin mapping of USB-C Power 2 Click driver.

Functions

void usbcpower2_cfg_setup (usbcpower2_cfg_t *cfg)
 USB-C Power 2 configuration object setup function.
err_t usbcpower2_init (usbcpower2_t *ctx, usbcpower2_cfg_t *cfg)
 USB-C Power 2 initialization function.
err_t usbcpower2_default_cfg (usbcpower2_t *ctx)
 USB-C Power 2 default configuration function.
err_t usbcpower2_write_reg (usbcpower2_t *ctx, uint8_t reg, uint8_t data_in)
 USB-C Power 2 write register function.
err_t usbcpower2_read_reg (usbcpower2_t *ctx, uint8_t reg, uint8_t *data_out)
 USB-C Power 2 read register function.
uint8_t usbcpower2_get_id_pin (usbcpower2_t *ctx)
 USB-C Power 2 get ID pin function.
uint8_t usbcpower2_get_int_pin (usbcpower2_t *ctx)
 USB-C Power 2 get INT pin function.
err_t usbcpower2_check_com (usbcpower2_t *ctx)
 USB-C Power 2 communication check function.

Detailed Description

API for configuring and manipulating USB-C Power 2 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ usbcpower2_cfg_setup()

void usbcpower2_cfg_setup ( usbcpower2_cfg_t * cfg)

USB-C Power 2 configuration object setup function.

This function initializes Click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See usbcpower2_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ usbcpower2_check_com()

err_t usbcpower2_check_com ( usbcpower2_t * ctx)

USB-C Power 2 communication check function.

This function checks communication with the device by reading the vendor ID register and validating the returned value.

Parameters
[in]ctx: Click context object. See usbcpower2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower2_default_cfg()

err_t usbcpower2_default_cfg ( usbcpower2_t * ctx)

USB-C Power 2 default configuration function.

This function executes a default configuration of USB-C Power 2 Click board.

Parameters
[in]ctx: Click context object. See usbcpower2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ usbcpower2_get_id_pin()

uint8_t usbcpower2_get_id_pin ( usbcpower2_t * ctx)

USB-C Power 2 get ID pin function.

This function reads and returns the logic state of the ID pin.

Parameters
[in]ctx: Click context object. See usbcpower2_t object definition for detailed explanation.
Returns
ID pin logic state.
Note
None.

◆ usbcpower2_get_int_pin()

uint8_t usbcpower2_get_int_pin ( usbcpower2_t * ctx)

USB-C Power 2 get INT pin function.

This function reads and returns the logic state of the INT pin.

Parameters
[in]ctx: Click context object. See usbcpower2_t object definition for detailed explanation.
Returns
INT pin logic state.
Note
None.

◆ usbcpower2_init()

err_t usbcpower2_init ( usbcpower2_t * ctx,
usbcpower2_cfg_t * cfg )

USB-C Power 2 initialization function.

This function initializes all necessary pins and peripherals used for this Click board.

Parameters
[out]ctx: Click context object. See usbcpower2_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See usbcpower2_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower2_read_reg()

err_t usbcpower2_read_reg ( usbcpower2_t * ctx,
uint8_t reg,
uint8_t * data_out )

USB-C Power 2 read register function.

This function reads a single byte of data from the selected readable register address.

Parameters
[in]ctx: Click context object. See usbcpower2_t object definition for detailed explanation.
[in]reg: Readable register address.
[out]data_out: Output data byte.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower2_write_reg()

err_t usbcpower2_write_reg ( usbcpower2_t * ctx,
uint8_t reg,
uint8_t data_in )

USB-C Power 2 write register function.

This function writes a single byte of data to the selected writable register address.

Parameters
[in]ctx: Click context object. See usbcpower2_t object definition for detailed explanation.
[in]reg: Writable register address.
[in]data_in: Data byte to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.